mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
update 查询枪口状态之前先查询该站点有没有推送第三方平台(华为)
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -143,10 +144,15 @@ public class PileController extends BaseController {
|
||||
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询充电枪口列表 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 修改对接第三方平台的枪口状态
|
||||
updateThirdPartyConnectorStatus(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error("修改对接第三方平台的枪口状态 error");
|
||||
}
|
||||
|
||||
try {
|
||||
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(dto);
|
||||
List<PileConnectorInfoVO> list = (List<PileConnectorInfoVO>) pageResponse.getList();
|
||||
updateThirdPartyConnectorStatus(list);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询充电枪口列表异常", e);
|
||||
@@ -186,26 +192,35 @@ public class PileController extends BaseController {
|
||||
|
||||
/**
|
||||
* 修改第三方平台枪口状态
|
||||
* @see com.jsowell.web.controller.pile.PileConnectorInfoController#updateThirdPartyConnectorStatus(com.jsowell.pile.dto.QueryConnectorListDTO)
|
||||
* 两个方法完全相同,如有修改需同步修改
|
||||
*/
|
||||
public void updateThirdPartyConnectorStatus(List<PileConnectorInfoVO> connectorList) {
|
||||
if (CollectionUtils.isEmpty(connectorList)) {
|
||||
private void updateThirdPartyConnectorStatus(QueryConnectorListDTO dto) {
|
||||
if (dto == null) {
|
||||
return;
|
||||
}
|
||||
List<String> stationIdList = connectorList.stream()
|
||||
.map(PileConnectorInfoVO::getStationId)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> pileIds = dto.getPileIds();
|
||||
List<Long> stationIdList = dto.getStationIdList();
|
||||
|
||||
for (String stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
||||
List<ThirdPartySnRelationVO> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(pileIds)) {
|
||||
list = snRelationService.selectSnRelationListByParams(null, null, pileIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||
for (Long stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
String stationId = vo.getStationId();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationId, thirdPartyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user