From b573bfb015b56e6fdaf21e4d7909fecd717bfc30 Mon Sep 17 00:00:00 2001 From: Lemon Date: Fri, 6 Sep 2024 10:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E7=AB=AF=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=80=9A=E8=BF=87=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BC=96=E5=8F=B7=E6=9F=A5=E8=AF=A2=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/运营小程序接口文档.md | 6 +- .../BusinessConnectorInfoController.java | 29 +++++++-- .../business/BusinessOrderController.java | 46 +++++++++++++++ .../pile/service/OrderBasicInfoService.java | 14 +++-- .../service/PileConnectorInfoService.java | 8 +++ .../impl/OrderBasicInfoServiceImpl.java | 15 +++++ .../impl/PileConnectorInfoServiceImpl.java | 53 +++++++++++++++++ .../business/BusinessConnectorDetailVO.java | 59 +++++++++++++++++++ .../business/BusinessConnectorInfoVO.java | 5 ++ .../pile/vo/uniapp/customer/OrderVO.java | 5 ++ .../mapper/pile/OrderBasicInfoMapper.xml | 1 + 11 files changed, 228 insertions(+), 13 deletions(-) create mode 100644 jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessOrderController.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java diff --git a/doc/运营小程序接口文档.md b/doc/运营小程序接口文档.md index eaa91b6e5..73cfea8ba 100644 --- a/doc/运营小程序接口文档.md +++ b/doc/运营小程序接口文档.md @@ -261,9 +261,9 @@ 入参 -| 字段名 | 类型 | 是否必传 | 备注 | -| ------ | ---- | -------- | ---- | -| | | | | +| 字段名 | 类型 | 是否必传 | 备注 | +| ----------------- | ------ | -------- | -------- | +| pileConnectorCode | String | Y | 枪口编码 | 反参 diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java index 4a9c627d4..e69aa4b42 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java @@ -5,15 +5,13 @@ import com.google.common.collect.ImmutableMap; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.business.QueryConnectorInfoDTO; +import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileConnectorInfoService; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO; import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -67,4 +65,27 @@ public class BusinessConnectorInfoController extends BaseController { logger.info("搜索枪口信息接口 params:{}, result:{}", JSONObject.toJSONString(dto), 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; + } + + + + } diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessOrderController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessOrderController.java new file mode 100644 index 000000000..a4ed06a1f --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessOrderController.java @@ -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; + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java index c3f7fa382..14ede4f70 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java @@ -463,6 +463,13 @@ public interface OrderBasicInfoService{ List queryOrderByOccupyTime(QueryOrderDTO dto); + /** + * 创建预约启动充电订单 + * @param chargingStartupResult + */ + void createReservationOrder(ReservationChargingStartupResult chargingStartupResult); + + //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ /** * 通过站点idList,创建时间查询订单数据详情 @@ -472,11 +479,6 @@ public interface OrderBasicInfoService{ */ List getOrderDetailByStationIds(List stationIds, String startTime, String endTime); - /** - * 创建预约启动充电订单 - * @param chargingStartupResult - */ - void createReservationOrder(ReservationChargingStartupResult chargingStartupResult); - + void getBusinessOrderDetail(String orderCode); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java index 8d8d5d7c0..5d7516416 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java @@ -157,4 +157,12 @@ public interface PileConnectorInfoService { * @return */ public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto); + + + /** + * 通过枪口编号查询枪口信息详情 + * @param pileConnectorCode + * @return + */ + public BusinessConnectorInfoVO getBusinessPileConnectorDetail(String pileConnectorCode); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index e29da0188..1127c98c2 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -3879,5 +3879,20 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { 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(); + + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index d97064c8a..6e9eaed9e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -14,6 +14,8 @@ import com.jsowell.common.core.page.PageResponse; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; 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.StringUtils; 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.service.*; 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.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileDetailVO; @@ -923,4 +926,54 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { } 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 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; + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java new file mode 100644 index 000000000..41eda80dd --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java @@ -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; +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorInfoVO.java index 6778e5cbb..a930ab2d5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorInfoVO.java @@ -65,4 +65,9 @@ public class BusinessConnectorInfoVO { private Integer faultConnectorNum; private List pileConnectorInfoVOList; + + /** + * 运营端小程序枪口详情信息 + */ + private BusinessConnectorDetailVO businessConnectorDetail; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/customer/OrderVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/customer/OrderVO.java index c335777a5..bbc61a289 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/customer/OrderVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/customer/OrderVO.java @@ -136,4 +136,9 @@ public class OrderVO { private BigDecimal totalElectricityAmount; private BigDecimal totalServiceAmount; + + /** + * 订单创建时间 + */ + private String createTime; } diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 8575fd3f9..6904937fe 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -2854,6 +2854,7 @@ t1.plate_number AS plateNumber, t1.discount_amount AS discountAmount, t1.settle_amount AS settleAmount, + t1.create_time as createTime, t1.charge_start_time AS startTime, t1.charge_end_time AS endTime, t1.start_soc AS startSoc,