bugfix 华为启动充电不再重复生成订单

This commit is contained in:
Lemon
2024-04-03 11:46:39 +08:00
parent 2b62f01a38
commit 994b9cd809
3 changed files with 36 additions and 26 deletions

View File

@@ -13,6 +13,7 @@ import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.dto.RemoteGroundLockDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
import com.jsowell.thirdparty.common.CommonService;
import org.apache.commons.collections4.CollectionUtils;
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* 充电桩相关接口
@@ -121,9 +123,6 @@ public class PileController extends BaseController {
RestApiResponse<?> response = null;
try {
PageResponse pageResponse = pileConnectorInfoService.getUniAppConnectorInfoListByParams(dto);
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
updateThirdPartyConnectorStatus(dto.getStationIdList());
}
response = new RestApiResponse<>(pageResponse);
} catch (Exception e) {
logger.error("查询充电枪口列表异常", e);
@@ -146,6 +145,8 @@ public class PileController extends BaseController {
RestApiResponse<?> response = null;
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,12 +187,15 @@ public class PileController extends BaseController {
/**
* 修改第三方平台枪口状态
*/
private void updateThirdPartyConnectorStatus(List<Long> stationIdList) {
if (CollectionUtils.isEmpty(stationIdList)) {
public void updateThirdPartyConnectorStatus(List<PileConnectorInfoVO> connectorList) {
if (CollectionUtils.isEmpty(connectorList)) {
return;
}
List<String> stationIdList = connectorList.stream()
.map(PileConnectorInfoVO::getStationId)
.collect(Collectors.toList());
for (Long stationId : stationIdList) {
for (String stationId : stationIdList) {
String stationIdStr = String.valueOf(stationId);
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
if (CollectionUtils.isEmpty(list)) {

View File

@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/**
* 充电桩枪口信息Controller
@@ -74,10 +75,8 @@ public class PileConnectorInfoController extends BaseController {
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
// 修改对接第三方平台的枪口状态
updateThirdPartyConnectorStatus(dto.getStationIdList());
}
// 修改对接第三方平台的枪口状态
updateThirdPartyConnectorStatus(list);
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
return getDataTable(list);
}
@@ -146,12 +145,15 @@ public class PileConnectorInfoController extends BaseController {
/**
* 修改第三方平台枪口状态
*/
public void updateThirdPartyConnectorStatus(List<Long> stationIdList) {
if (CollectionUtils.isEmpty(stationIdList)) {
public void updateThirdPartyConnectorStatus(List<PileConnectorInfoVO> connectorList) {
if (CollectionUtils.isEmpty(connectorList)) {
return;
}
List<String> stationIdList = connectorList.stream()
.map(PileConnectorInfoVO::getStationId)
.collect(Collectors.toList());
for (Long stationId : stationIdList) {
for (String stationId : stationIdList) {
String stationIdStr = String.valueOf(stationId);
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
if (CollectionUtils.isEmpty(list)) {