This commit is contained in:
Guoqs
2024-09-03 09:36:32 +08:00
8 changed files with 127 additions and 17 deletions

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

@@ -876,8 +876,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>