mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-12 03:09:48 +08:00
新增 运营端小程序搜索枪口信息接口
This commit is contained in:
@@ -232,23 +232,26 @@
|
|||||||
|
|
||||||
# 站点充电实况搜索
|
# 站点充电实况搜索
|
||||||
|
|
||||||
接口地址:
|
接口地址:http://localhost:8080/business/pile/connector/searchConnectorInfo
|
||||||
|
|
||||||
请求方式:
|
请求方式:POST
|
||||||
|
|
||||||
入参
|
### 入参
|
||||||
|
|
||||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||||
| ------ | ---- | -------- | ---------- |
|
| ----------------- | ------ | -------- | ---------- |
|
||||||
| | | Y | 充电枪编号 |
|
| stationId | String | Y | 站点id |
|
||||||
|
| pileConnectorCode | String | Y | 充电枪编号 |
|
||||||
|
|
||||||
反参
|
### 反参
|
||||||
|
|
||||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||||
| ------ | ---- | -------- | ------------ |
|
| ----------------- | ------ | -------- | ---------- |
|
||||||
| | | Y | 充电枪编号 |
|
| pileConnectorCode | String | Y | 充电枪编号 |
|
||||||
| | | Y | 当前状态 |
|
| orderCode | String | N | 订单编号 |
|
||||||
| | | Y | 当前状态时长 |
|
| SOC | String | N | 充电百分比 |
|
||||||
|
| chargingTime | String | N | 已充时长 |
|
||||||
|
| timeRemaining | String | N | 剩余时长 |
|
||||||
|
|
||||||
# 充电枪情况
|
# 充电枪情况
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
|
|||||||
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 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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -39,7 +40,7 @@ public class BusinessConnectorInfoController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
BusinessConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getConnectorListByStationAndStatus(dto);
|
BusinessConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getConnectorListByStationAndStatus(dto);
|
||||||
response = new RestApiResponse<>(ImmutableMap.of("ConnectorInfoVO", connectorInfoVO));
|
response = new RestApiResponse<>(ImmutableMap.of("BusinessConnectorInfoVO", connectorInfoVO));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("获取枪口信息列表 error", e);
|
logger.error("获取枪口信息列表 error", e);
|
||||||
response = new RestApiResponse<>(e);
|
response = new RestApiResponse<>(e);
|
||||||
@@ -47,4 +48,23 @@ 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 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ public class QueryConnectorInfoDTO {
|
|||||||
* 每页条数
|
* 每页条数
|
||||||
*/
|
*/
|
||||||
private int pageSize;
|
private int pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪口编号
|
||||||
|
*/
|
||||||
|
private String pileConnectorCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.mapper;
|
|||||||
|
|
||||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||||
import com.jsowell.pile.dto.QueryConnectorDTO;
|
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.base.ConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -120,4 +121,11 @@ public interface PileConnectorInfoMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PileConnectorInfo> getConnectorStatus(@Param("pileConnectorCodeList") List<String> pileConnectorCodeList);
|
List<PileConnectorInfo> getConnectorStatus(@Param("pileConnectorCodeList") List<String> pileConnectorCodeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过查询参数查询枪口信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PileConnectorInfoVO getConnectorInfoByParams(@Param("dto") QueryConnectorInfoDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,4 +143,18 @@ public interface PileConnectorInfoService {
|
|||||||
* 通过站点id和枪口状态查询枪口列表
|
* 通过站点id和枪口状态查询枪口列表
|
||||||
*/
|
*/
|
||||||
BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
|
BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过查询参数查询枪口信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PileConnectorInfoVO getConnectorInfoByParams(QueryConnectorInfoDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营端小程序搜索枪口信息接口
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -865,8 +865,51 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
|||||||
.filter(x -> x.getStatus() == Integer.parseInt(connectorStatus))
|
.filter(x -> x.getStatus() == Integer.parseInt(connectorStatus))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
vo.setPileConnectorInfoVOList(pileConnectorInfoVOList);
|
vo.setPileConnectorInfoVOList(pileConnectorInfoVOList);
|
||||||
return vo;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,4 +257,20 @@
|
|||||||
#{pileConnectorCode,jdbcType=VARCHAR}
|
#{pileConnectorCode,jdbcType=VARCHAR}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user