This commit is contained in:
Guoqs
2024-08-29 14:40:46 +08:00
5 changed files with 157 additions and 59 deletions

View File

@@ -189,36 +189,46 @@
# 站点充电实况列表
接口地址:
接口地址:http://localhost:8080/business/pile/connector/getBusinessConnectorInfoList
请求方式:
请求方式:POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| --------------- | ------- | -------- | ------------------------------------------------------------ |
| stationId | String | Y | 站点id |
| connectorStatus | String | N | 枪口状态0离网 1空闲2占用未充电3占用充电中4占用预约锁定即挂起 255故障 |
| pageNum | Integer | N | 页码 |
| pageSize | Integer | N | 每页条数 |
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------------- | ------------------------- | -------- | -------------- |
| | | Y | 站点名称 |
| connectorNum | Integer | Y | 全部枪口数量 |
| chargingConnectorNum | Integer | Y | 充电中枪口数量 |
| freeConnectorNum | Integer | Y | 空闲枪口数量 |
| hangingConnectorNum | Integer | Y | 挂起枪口数量 |
| occupiedConnectorNum | Integer | Y | 占用枪口数量 |
| offlineConnectorNum | Integer | Y | 离线枪口数量 |
| faultConnectorNum | Integer | Y | 故障枪口数量 |
| pileConnectorInfoVOList | List<PileConnectorInfoVO> | Y | 枪口信息数组 |
### PileConnectorInfoVO
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | -------------------------- |
| pileConnectorCode | String | Y | 充电枪编号 |
| SOC | String | Y | 充电中soc% |
| timeRemaining | String | Y | 充电中充满剩余时长(分钟) |
| chargingTime | String | Y | 已充时长 |
| faultReason | String | Y | 故障原因 |
入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ---- |
| | | | |
反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | -------------------------- |
| | | Y | 站点名称 |
| | | Y | 全部枪口数量 |
| | | Y | 充电中枪口数量 |
| | | Y | 空闲枪口数量 |
| | | Y | 挂起枪口数量 |
| | | Y | 占用枪口数量 |
| | | Y | 离线枪口数量 |
| | | Y | 故障枪口数量 |
| | | Y | 充电枪编号 |
| | | Y | 充电中soc% |
| | | Y | 充电中充满剩余时长(分钟) |
| | | Y | 空闲时长(分钟) |
| | | Y | 挂起时长(分钟) |
| | | Y | 占用时长(分钟) |
| | | Y | 离线时长(分钟) |
| | | Y | 故障时长(分钟) |
# 站点充电实况搜索
@@ -300,24 +310,6 @@
1、预约充电结束时间不选择即为充满自停
2、充电中的数据下拉不刷新
3、预约充电显示预约状态成功预约中失败
4、预约充电订单目前不显示实时充电数据
5、桩主需要能看到桩的实时状态
1、在 ==站点管理== ——> ==运营管理== 中勾选浙江省平台,点击保存按钮
<img src="C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20240816100744446.png" alt="image-20240816100744446" style="zoom: 33%;" />
@@ -325,6 +317,3 @@
2、在 ==三方平台管理== ——> ==对接第三方平台关系== 页面中找到浙江省平台,点击 ==同步数据==,找到对应站点,点击 ==打开推送菜单== 页面, 点击右侧 ==推送充电站信息变化== 右侧的 ==推送== 按钮
<img src="C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20240816100551217.png" alt="image-20240816100551217" style="zoom: 50%;" />

View File

@@ -0,0 +1,50 @@
package com.jsowell.api.uniapp.business;
import com.alibaba.fastjson2.JSONObject;
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.PileConnectorInfoService;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
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 java.util.List;
/**
* 运营端小程序枪口信息相关controller
*
* @author Lemon
* @Date 2024/8/27 16:04:31
*/
@RestController
@RequestMapping("/business/pile/connector")
public class BusinessConnectorInfoController extends BaseController {
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
/**
* 获取枪口信息列表
* @param dto
* @return
*/
@PostMapping("/getBusinessConnectorInfoList")
public RestApiResponse<?> getBusinessConnectorInfoList(@RequestBody QueryConnectorInfoDTO dto) {
RestApiResponse<?> response = null;
try {
BusinessConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getConnectorListByStationAndStatus(dto);
response = new RestApiResponse<>(ImmutableMap.of("ConnectorInfoVO", connectorInfoVO));
} catch (Exception e) {
logger.error("获取枪口信息列表 error", e);
response = new RestApiResponse<>(e);
}
logger.info("获取枪口信息列表 params:{}, result:{}", JSONObject.toJSONString(dto), response);
return response;
}
}

View File

@@ -7,6 +7,7 @@ import com.jsowell.pile.dto.QueryConnectorListDTO;
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import java.util.List;
@@ -141,5 +142,5 @@ public interface PileConnectorInfoService {
/**
* 通过站点id和枪口状态查询枪口列表
*/
void getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
}

View File

@@ -27,6 +27,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.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
@@ -772,29 +773,84 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
}
/**
* 批量获取枪口状态
* 批量获取某状态的枪口数量
* @param pileConnectorCodeList
* @return
*/
private Map<String, String> getConnectorStatus(List<String> pileConnectorCodeList) {
private Map<String, Integer> getConnectorStatus(List<String> pileConnectorCodeList) {
List<PileConnectorInfo> pileConnectorInfos = pileConnectorInfoMapper.getConnectorStatus(pileConnectorCodeList);
int offlineNum = Constants.zero;
int freeNum = Constants.zero;
int occupiedNum = Constants.zero;
int chargingNum = Constants.zero;
int faultNum = Constants.zero;
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
String status = pileConnectorInfo.getStatus();
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue())) {
// 离网
offlineNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FREE.getValue())) {
// 空闲
freeNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue())) {
// 占用未充电
occupiedNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) {
// 充电中
chargingNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FAULT.getValue())) {
// 故障
faultNum += 1;
}
}
return null;
Map<String, Integer> map = new LinkedHashMap<>();
map.put("offlineNum", offlineNum);
map.put("freeNum", freeNum);
map.put("occupiedNum", occupiedNum);
map.put("chargingNum", chargingNum);
map.put("faultNum", faultNum);
return map;
}
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
/**
* 查询站点枪口列表
* @param dto
* @return
*/
@Override
public void getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) {
public BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) {
String stationId = dto.getStationId();
String connectorStatus = dto.getConnectorStatus();
int pageNum = dto.getPageNum();
int pageSize = dto.getPageSize();
BusinessConnectorInfoVO vo = new BusinessConnectorInfoVO();
// 根据站点id查询枪口列表(有缓存)
List<ConnectorInfoVO> uniAppConnectorList = getUniAppConnectorList(Long.parseLong(stationId));
// 筛选出枪口编号
List<String> pileConnectorCodeList = uniAppConnectorList.stream()
.map(ConnectorInfoVO::getPileConnectorCode)
.collect(Collectors.toList());
// 批量获取某状态的枪口数量
Map<String, Integer> connectorStatusNumMap = getConnectorStatus(pileConnectorCodeList);
Integer offlineNum = connectorStatusNumMap.get("offlineNum");
Integer freeNum = connectorStatusNumMap.get("freeNum");
Integer occupiedNum = connectorStatusNumMap.get("occupiedNum");
Integer chargingNum = connectorStatusNumMap.get("chargingNum");
Integer faultNum = connectorStatusNumMap.get("faultNum");
vo.setConnectorNum(pileConnectorCodeList.size());
vo.setOfflineConnectorNum(offlineNum);
vo.setFreeConnectorNum(freeNum);
vo.setOccupiedConnectorNum(occupiedNum);
vo.setChargingConnectorNum(chargingNum);
vo.setFaultConnectorNum(faultNum);
// 根据站点id和枪口状态查询枪口列表
QueryConnectorListDTO queryConnectorListDTO = QueryConnectorListDTO.builder()
@@ -810,5 +866,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
.collect(Collectors.toList());
}
vo.setPileConnectorInfoVOList(pileConnectorInfoVOList);
return vo;
}
}

View File

@@ -32,37 +32,37 @@ public class BusinessConnectorInfoVO {
/**
* 总枪口数量
*/
private String connectorNum;
private Integer connectorNum;
/**
* 充电中枪口数量
*/
private String chargingConnectorNum;
private Integer chargingConnectorNum;
/**
* 空闲枪口数量
*/
private String freeConnectorNum;
private Integer freeConnectorNum;
/**
* 挂起枪口数量
*/
private String hangingConnectorNum;
private Integer hangingConnectorNum;
/**
* 占用中枪口数量
*/
private String occupiedConnectorNum;
private Integer occupiedConnectorNum;
/**
* 离线枪口数量
*/
private String offlineConnectorNum;
private Integer offlineConnectorNum;
/**
* 故障枪口数量
*/
private String faultConnectorNum;
private Integer faultConnectorNum;
private List<PileConnectorInfoVO> pileConnectorInfoVOList;
}