新增 运营端小程序搜索枪口信息接口

This commit is contained in:
Lemon
2024-09-03 08:47:55 +08:00
parent f8f69e37e3
commit ed7ed05b68
8 changed files with 127 additions and 17 deletions

View File

@@ -232,23 +232,26 @@
# 站点充电实况搜索
接口地址:
接口地址:http://localhost:8080/business/pile/connector/searchConnectorInfo
请求方式:
请求方式:POST
入参
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ---------- |
| | | Y | 充电枪编号 |
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | ---------- |
| stationId | String | Y | 站点id |
| pileConnectorCode | String | Y | 充电枪编号 |
反参
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ------------ |
| | | Y | 充电枪编号 |
| | | Y | 当前状态 |
| | | Y | 当前状态时长 |
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | ---------- |
| pileConnectorCode | String | Y | 充电枪编号 |
| orderCode | String | N | 订单编号 |
| SOC | String | N | 充电百分比 |
| chargingTime | String | N | 已充时长 |
| timeRemaining | String | N | 剩余时长 |
# 充电枪情况

View File

@@ -8,6 +8,7 @@ import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
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;
@@ -39,7 +40,7 @@ public class BusinessConnectorInfoController extends BaseController {
RestApiResponse<?> response = null;
try {
BusinessConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getConnectorListByStationAndStatus(dto);
response = new RestApiResponse<>(ImmutableMap.of("ConnectorInfoVO", connectorInfoVO));
response = new RestApiResponse<>(ImmutableMap.of("BusinessConnectorInfoVO", connectorInfoVO));
} catch (Exception e) {
logger.error("获取枪口信息列表 error", e);
response = new RestApiResponse<>(e);
@@ -47,4 +48,23 @@ public class BusinessConnectorInfoController extends BaseController {
logger.info("获取枪口信息列表 params:{}, result:{}", JSONObject.toJSONString(dto), response);
return response;
}
/**
* 搜索枪口信息接口
* @param dto
* @return
*/
@PostMapping("/searchConnectorInfo")
public RestApiResponse<?> BusinessSearchConnectorInfo(@RequestBody QueryConnectorInfoDTO dto) {
RestApiResponse<?> response = null;
try {
PileConnectorInfoVO pileConnectorInfoVO = pileConnectorInfoService.BusinessSearchConnectorInfo(dto);
response = new RestApiResponse<>(ImmutableMap.of("pileConnectorInfoVO", pileConnectorInfoVO));
} catch (Exception e) {
logger.error("搜索枪口信息接口 error", e);
response = new RestApiResponse<>(e);
}
logger.info("搜索枪口信息接口 params:{}, result:{}", JSONObject.toJSONString(dto), response);
return response;
}
}

View File

@@ -35,4 +35,9 @@ public class QueryConnectorInfoDTO {
* 每页条数
*/
private int pageSize;
/**
* 枪口编号
*/
private String pileConnectorCode;
}

View File

@@ -2,6 +2,7 @@ package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.PileConnectorInfo;
import com.jsowell.pile.dto.QueryConnectorDTO;
import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import org.apache.ibatis.annotations.Param;
@@ -120,4 +121,11 @@ public interface PileConnectorInfoMapper {
* @return
*/
List<PileConnectorInfo> getConnectorStatus(@Param("pileConnectorCodeList") List<String> pileConnectorCodeList);
/**
* 通过查询参数查询枪口信息
* @param dto
* @return
*/
PileConnectorInfoVO getConnectorInfoByParams(@Param("dto") QueryConnectorInfoDTO dto);
}

View File

@@ -143,4 +143,18 @@ public interface PileConnectorInfoService {
* 通过站点id和枪口状态查询枪口列表
*/
BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
/**
* 通过查询参数查询枪口信息
* @param dto
* @return
*/
PileConnectorInfoVO getConnectorInfoByParams(QueryConnectorInfoDTO dto);
/**
* 运营端小程序搜索枪口信息接口
* @param dto
* @return
*/
public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto);
}

View File

@@ -865,8 +865,51 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
.filter(x -> x.getStatus() == Integer.parseInt(connectorStatus))
.collect(Collectors.toList());
}
vo.setPileConnectorInfoVOList(pileConnectorInfoVOList);
return vo;
}
/**
* 通过查询参数查询枪口信息
* @param dto
* @return
*/
@Override
public PileConnectorInfoVO getConnectorInfoByParams(QueryConnectorInfoDTO dto) {
return pileConnectorInfoMapper.getConnectorInfoByParams(dto);
}
/**
* 运营端小程序搜索枪口信息接口
* @param dto
* @return
*/
@Override
public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto) {
PileConnectorInfoVO vo = new PileConnectorInfoVO();
String stationId = dto.getStationId();
String pileConnectorCode = dto.getPileConnectorCode();
vo.setStationId(stationId);
vo.setPileConnectorCode(pileConnectorCode);
// 通过站点id和枪口号查询枪口信息
QueryConnectorInfoDTO queryDTO = QueryConnectorInfoDTO.builder()
.stationId(stationId)
.pileConnectorCode(pileConnectorCode)
.build();
PileConnectorInfoVO connectorInfoVO = getConnectorInfoByParams(queryDTO);
if (connectorInfoVO == null) {
return vo;
}
// 如果状态为充电中将SOC、已充时长、剩余时长返回
if (StringUtils.equals(String.valueOf(connectorInfoVO.getStatus()), PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) {
// 当枪口状态为充电中时,再去查询实时数据等信息
OrderBasicInfo order = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
if (order != null) {
vo.setOrderCode(order.getOrderCode());
}
queryRealTimeData(Lists.newArrayList(vo));
}
return vo;
}
}

View File

@@ -257,4 +257,20 @@
#{pileConnectorCode,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getConnectorInfoByParams" resultType="com.jsowell.pile.vo.web.PileConnectorInfoVO">
SELECT
t1.id AS stationId,
-- t2.sn AS pileSn,
t3.pile_connector_code AS pileConnectorCode,
t3.status
FROM
pile_station_info t1
JOIN pile_basic_info t2 ON t1.id = t2.station_id
JOIN pile_connector_info t3 ON t2.sn = t3.pile_sn
WHERE
t1.id = #{dto.stationId,jdbcType=VARCHAR}
AND
t3.pile_connector_code = #{dto.pileConnectorCode,jdbcType=VARCHAR}
</select>
</mapper>

File diff suppressed because one or more lines are too long